package com.hzw.preview.day02;

import java.lang.reflect.Field;
import java.lang.reflect.Method;

public class Demo01 {
    public static void main(String[] args) throws Exception{
        Class<?> aClass = Class.forName("com.hzw.preview.day02.Cz01");
        Field name = aClass.getDeclaredField("name");
        name.setAccessible(true);
        Object o = aClass.newInstance();
        name.set(o,"zhen");

        Method getName = aClass.getDeclaredMethod("getName");
        Object invoke = getName.invoke(o);
        System.out.println(invoke);
    }
}
